Skip to content

Fix issue 20063 - Patch closure variables when converting expressions to delegates#10196

Merged
dlang-bot merged 1 commit intodlang:stablefrom
SSoulaimane:fix20063
Jul 19, 2019
Merged

Fix issue 20063 - Patch closure variables when converting expressions to delegates#10196
dlang-bot merged 1 commit intodlang:stablefrom
SSoulaimane:fix20063

Conversation

@SSoulaimane
Copy link
Member

Issue 20063.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @SSoulaimane! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20063 regression compiler segfaults on passing templates expression to lazy val

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "stable + dmd#10196"

@dlang-bot dlang-bot merged commit 7600fe8 into dlang:stable Jul 19, 2019
if (!vd || !pfd)
return;
// move to fd's closure when applicable
foreach (i; 0 .. pfd.closureVars.dim)
Copy link
Member

@PetarKirov PetarKirov Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, one should be careful when using foreach (; 0 .. max) and changing the max inside the loop, as the emitted code caches it:
https://run.dlang.io/gist/run-dlang/b0b40d58474fb7c35b22803b2432c02f?compiler=dmd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I notice that, but the code here breaks immediately after remove() is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants